package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckItemAndCheckGroup {
    @Insert("insert into t_checkgroup_checkitem(checkgroup_id,checkitem_id) values(#{id},#{checkitemId})")
    void addCheckItemAndCheckGroup(Integer id, Integer checkitemId);

    //根据检查组id删除检查项和检查组关系
    @Delete("delete from t_checkgroup_checkitem where checkgroup_id = #{id}")
    void deleteByCheckGroupId(Integer id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id}")
    List<Integer> findCheckItemIdsByCheckGroupId(Integer id);
}
